adc28 2.2.0
Loading...
Searching...
No Matches
adc28


ADC 28 Click

ADC 28 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Milan Ivancic
  • Date : Apr 2026.
  • Type : I2C type

Software Support

Example Description

This example demonstrates the use of the ADC 28 Click board by reading voltage levels from all 8 single-ended analog input channels (CH0-CH7) and displaying the results via UART.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.ADC28

Example Key Functions

  • adc28_cfg_setup This function initializes Click configuration structure to initial values.
    void adc28_cfg_setup(adc28_cfg_t *cfg)
    ADC 28 configuration object setup function.
    ADC 28 Click configuration object.
    Definition adc28.h:322
  • adc28_init This function initializes all necessary pins and peripherals used for this Click board.
    err_t adc28_init ( adc28_t *ctx, adc28_cfg_t *cfg );
    err_t adc28_init(adc28_t *ctx, adc28_cfg_t *cfg)
    ADC 28 initialization function.
    ADC 28 Click context object.
    Definition adc28.h:302
  • adc28_default_cfg This function executes a default configuration of ADC 28 Click board.
    err_t adc28_default_cfg ( adc28_t *ctx );
    err_t adc28_default_cfg(adc28_t *ctx)
    ADC 28 default configuration function.
  • adc28_read_raw_adc This function reads the RAW ADC measurement.
    err_t adc28_read_raw_adc ( adc28_t *ctx, uint8_t channel, uint16_t *raw_data );
    err_t adc28_read_raw_adc(adc28_t *ctx, uint8_t channel, uint16_t *raw_data)
    ADC 28 read raw ADC function.
  • adc28_read_voltage This function reads the ADC result from the selected channel and converts it to a voltage level.
    err_t adc28_read_voltage ( adc28_t *ctx, uint8_t channel, float *voltage );
    err_t adc28_read_voltage(adc28_t *ctx, uint8_t channel, float *voltage)
    ADC 28 read voltage function.
  • adc28_get_alert_pin This function returns the logic state of the ALT (ALERT) pin.
    uint8_t adc28_get_alert_pin ( adc28_t *ctx );
    uint8_t adc28_get_alert_pin(adc28_t *ctx)
    ADC 28 get alert pin function.

Application Init

Initializes the driver and performs the Click default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
adc28_cfg_t adc28_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
adc28_cfg_setup( &adc28_cfg );
if ( I2C_MASTER_ERROR == adc28_init( &adc28, &adc28_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( ADC28_ERROR == adc28_default_cfg ( &adc28 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
@ ADC28_ERROR
Definition adc28.h:340
#define ADC28_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition adc28.h:289
void application_init(void)
Definition main.c:38
#define MIKROBUS_POSITION_ADC28
Definition main.c:32

Application Task

Reads the voltage from each channel (CH0 to CH7) and displays the results on the USB UART once per second.

void application_task ( void )
{
float voltage = 0;
for ( uint8_t channel = ADC28_CHANNEL_0; channel <= ADC28_CHANNEL_7; channel++ )
{
if ( ADC28_OK == adc28_read_voltage( &adc28, channel, &voltage ) )
{
log_printf( &logger, " CH%u: %.3f V\r\n", ( uint16_t ) channel, voltage );
}
}
log_printf( &logger, " -------------------\r\n" );
Delay_ms( 1000 );
}
@ ADC28_OK
Definition adc28.h:339
#define ADC28_CHANNEL_7
Definition adc28.h:222
#define ADC28_CHANNEL_0
ADC 28 channel selection setting.
Definition adc28.h:215
void application_task(void)
Definition main.c:74

Note

The input voltage range on each channel is 0 V to 3.3 V. Do not apply voltages outside this range to the analog inputs.

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.